@extends('admin::layouts.master')
@section('content')
    <form action="{{route('addPermission',$role['id'])}}" method="post">
        @csrf
    <div class="col-lg-12">
        <div class="card card-flat">
            <div class="card-header">为[{{$role['name']}}]设置权限</div>
            <div class="card-body">
                @foreach($permissions as $v)
                    @foreach($v['rules'] as $vv)
                <div class="form-group row pt-1 pb-1">
                    <label class="col-12 col-sm-3 col-form-label text-sm-right">{{$vv['group']}}</label>
                    <div class="col-12 col-sm-8 col-lg-6 form-check mt-2">
                        @foreach($vv['permissions'] as $vvv)

                        <label class="custom-control custom-checkbox custom-control-inline">
                            @if($role->hasPermissionTo($vvv['name']))
                            <input type="checkbox" checked name="name[]"   value="{{$vvv['name']}}" class="custom-control-input">
                            @else
                            <input type="checkbox" name="name[]"   value="{{$vvv['name']}}" class="custom-control-input">
                            @endif
                            <span class="custom-control-label">{{$vvv['title']}}</span>
                        </label>

                            @endforeach
                    </div>
                </div>
                        @endforeach
                    @endforeach
            </div>
            <div class="card-footer">
                <button class="btn btn-primary btn-lg">保存</button>
            </div>
        </div>
    </div>
    </form>
@endsection
